# DINOSNES Makefile
# Philippe Johnson

TARGET   = dinosnes.exe

#PATHS
CPUPATH  = ./cpu
FILEPATH = ./file
MEMPATH  = ./memory
SNESPATH = ./snes

VARFLAGS = -DDEBUG -DOPCODEDEBUG

CC       = gcc
CCFLAGS  = -g ${VARFLAGS} #-Wall
#LIBS
INCLUDES = -I. -I./cpu -I./debug -I./file -I./memory -I./snes

MAINSRC  = ./dinosnes.c
CPUSRC   = ${CPUPATH}/65c816.c ${CPUPATH}/opcodes.c ${CPUPATH}/opcodetables.c
CPUOBJS  = ${CPUPATH}/65c816.o ${CPUPATH}/opcodes.o ${CPUPATH}/cpuhelpers.o \
	     ${CPUPATH}/opcodetables.o

FILESRC  = ${FILEPATH}/rommanager.c
FILEOBJS = ${FILEPATH}/rommanager.o

MEMORYOBJS = ${MEMPATH}/memory.o ${MEMPATH}/mmio.o ${MEMPATH}/mmiotable.o
MEMORYSRC  = ${MEMPATH}/memory.c ${MEMPATH}/mmio.c

SNESSRC    = ${SNESPATH}/snes.c
SNESOBJS   = ${SNESPATH}/snes.o

OBJS = ${CPUOBJS} ${FILEOBJS} ${MEMORYOBJS} ${SNESOBJS}
SRCS = ${MAINSRC} ${CPUSRC} ${FILESRC} ${MEMORYSRC} ${SNESSRC}

all: dinosnes 

dinosnes: ${MAINSRC} ${CPUSRC} ${FILESRC} ${MEMORYSRC} ${SNESSRC}
	${CC} ${CCFLAGS} ${INCLUDES} ${SRCS} -o ${TARGET}

cpu: ${CPUSRC}
	${CC} ${CCFLAGS} ${VARFLAGS} ${INCLUDES} -c $<

file: ${FILESRC}
	${CC} ${CCLAGS} ${VARFLAGS} ${INCLUDES} -c $<

memory: ${MEMORYSRC}
	${CC} ${CCFLAGS} ${VARFLAGS} ${INCLUDES} -c $<

snes: ${SNESSRC}
	${CC} ${CCFLAGS} ${VARFLAGS} ${INCLUDES} -c $<

clean:
	rm -rf *.o dinosnes *~
